package com.guoxin.chapter4.reentractlock.trylocktest;

import java.util.concurrent.locks.ReentrantLock;

public class Service {
	private ReentrantLock lock = new ReentrantLock();
	
	public void waitMetod(){
		if(lock.tryLock()){
			System.out.println(Thread.currentThread().getName()+" 获得锁");
		}else{
			System.out.println(Thread.currentThread().getName()+" 没有获得锁");
		}
	}
}
